package cn.tedu.notice.pojo.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.assertj.core.error.ShouldBeSymbolicLink;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class NoticeQuery {
    @ApiModelProperty(value = "公告id")
    private Integer id;

    @ApiModelProperty(value = "公告标题")
    private String title;

    @ApiModelProperty(value = "公告等级")
    private String level;

    @ApiModelProperty(value = "公告状态 1-启用 0-禁用")
    private String status;

    @ApiModelProperty(value = "自定义排序的列名")
    private String sortColumn;

    @ApiModelProperty(value = "是否要对自定义排序的列进行排序")
    private String ascFlag;

    /**
     * 注解中的样式如果为yyyy-MM-dd HH:mm:ss的话，前端传的时候必须是这样的格式，
     * 如果前端只传yyyy-MM-dd的话，就会报异常。
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "公告的创建时间")
    private Date createTime;

    @ApiModelProperty(value = "发布人id")
    private Integer createPeopleId;


    //分页
    private Integer currentPage = 1;
    private Integer pageSize = 5;

    public Integer getBegin() {
        return (this.currentPage - 1) * this.pageSize;
    }

}
